home *** CD-ROM | disk | FTP | other *** search
/ The Arsenal Files 3 / The Arsenal Files 3.iso / gen_prog / appdemo.exe / DEMOBIRT.APP < prev    next >
Text File  |  1994-11-07  |  2KB  |  44 lines

  1. // This simple program calculates which day of the week you were born in.
  2.  
  3. // The following lines tells the compiler which library files to use.
  4. #include "STRING.APP"
  5. #include "MAINLIB.APP"  // MAINLIB.APP must always be the last #include
  6.  
  7. int Main()
  8. {
  9.  // All items after double slashes // are comments
  10.  
  11.  // Declare the three variables used
  12.  int Day;
  13.  int Month;
  14.  int Year;
  15.  
  16.  // In C++ and A++ "cout" is the standard output device (ie. the Screen)
  17.  // The "<<" is used to show in which way the information flows
  18.  // In C++ and A++ the "\n" means "New Line"
  19.  cout << "Hello, Please enter the following about your birthday\n\n";
  20.  cout << "Month Born (1 - 12) = ";        
  21.  // In C++ and A++ cin is the Standard input device (ie.  the Keyboard)
  22.  cin >> Month;
  23.  cout << "Day of Month Born (1 - 31) = "; 
  24.  cin >> Day;
  25.  cout << "Year Born (1900 - 2000) = ";
  26.  cin >> Year;
  27.  // In the next line a Function is called which returns the Day of the Week
  28.  // when it is given the Day, Month and Year.
  29.  // DX is a register in the CPU.
  30.  DX = DayOfWeek(Day, Month, Year);
  31.  cout << "You were born on a ";
  32.  // In A++, like C++, the "==" is used to test if "Equal To"
  33.  if(DX == 0) cout << "Sunday";
  34.  else if(DX == 1) cout << "Monday";
  35.  else if(DX == 2) cout << "Tuesday";
  36.  else if(DX == 3) cout << "Wednesday";
  37.  else if(DX == 4) cout << "Thursday";
  38.  else if(DX == 5) cout << "Friday";
  39.  else if(DX == 6) cout << "Saturday";
  40.  cout << "\n\n";  // Move down by two lines
  41.  return 0;  // Return to DOS with Error 0
  42. }
  43.  
  44.